import Vue from "vue";
import App from "./App.vue";
import ElementUI from "element-ui";
// import "normalize.css";
import "element-ui/lib/theme-chalk/index.css";
import router from "./router";
import store from "./store";
import './assets/css/reset.css'
import "./assets/css/common.css";
import { Indicator } from 'mint-ui'
import axios from "axios";
// import './assets/js/rem'
import "lib-flexible";
import './assets/css/mintui.css';
import echarts from "echarts";
import MintUi from "mint-ui";
import 'mint-ui/lib/style.css';
// 全局的API请求路径
import { api } from './assets/js/apiConfig';
// 全局方法
import methodApi from "@/components/method/common.js"
// 全局变量
import variable from "@/components/method/variable.js"
// 注册全局组件
import headerTab from "@/components/commons/headerTab"
// 浏览器title
import VueWechatTitle from 'vue-wechat-title'

Vue.component('headerTab', headerTab)
// 绑定vue原型方法；
// require("./assets/js/rem");
Vue.prototype.$axios = axios;
Vue.prototype.$api = api;
Vue.prototype.methodApi = methodApi;
Vue.prototype.globalVariable = variable;
axios.defaults.baseURL = "/";
axios.defaults.headers.post["Content-Type"] = "application/json";
Vue.use(ElementUI);
Vue.use(MintUi);
Vue.use(VueWechatTitle)
Vue.prototype.$echarts = echarts;

//请求拦截器
axios.interceptors.request.use((config) => {
	Indicator.open({
		text: '加载中.....',
		spinnerType: 'fading-circle'
	});
	return config;
}, (err) => {
	return Promise.reject(err)
})

// 响应拦截器
axios.interceptors.response.use((response) => {
	Indicator.close();
	return response;
}, (err) => {
	Indicator.close();
	return Promise.reject(err);
});


Vue.config.productionTip = false;
new Vue({
	router,
	store,
	render: h => h(App)
}).$mount("#app");
